﻿@using NuGetGallery
@model DeleteUserViewModel
@{
    ViewBag.Title = "Delete Account " + Model.AccountName;
    ViewBag.MdPageColumns = GalleryConstants.ColumnsFormMd;
}

<section role="main" class="container main-container page-delete-account">
    <div class="form-group">
        <div class="form-group">
            @ViewHelpers.Breadcrumb(true, @<text><a href="@Url.User(@Model.User)">@Model.AccountName</a></text>, @<text>Delete user</text>)

            @ViewHelpers.AlertDanger(@<text>
                <b class="keywords">Once this user is deleted, it cannot be undone!</b> <br />
                Deleting this user will: <br />
                1. Revoke any associated API key(s). <br />
                2. Remove the user as an owner for any child packages.<br />
                3. Dissociate all previously existent ID prefix reservations with this user.<br />
                4. Remove the user as a member of any organizations.<br />
            </text>)

            <div class="form-group">
                @Html.Partial("_UserPackagesListForDeletedAccount", Model)
            </div>
            <div class="form-group">
                @Html.Partial("_UserOrganizationsListForDeletedAccount", Model.Organizations)
            </div>
        </div>
        <div class="form-group danger-zone">
            @using (Html.BeginForm("Delete", "Users", FormMethod.Post, new { id = "delete-form" }))
            {
                @Html.Partial("_DeleteUserAccountForm", new DeleteAccountAsAdminViewModel(Model))
            }
        </div>
    </div>
</section>

@section BottomScripts {
    <script type="text/javascript">
        $(function () {
            $('#delete-form').submit(function (e) {
                if (!confirm('Are you sure you want to continue to delete this user?')) {
                    e.preventDefault();
                }
            });
        });
    </script>
}